<?
 require("employee.php");
 

 if(isset($_POST['createNew']))
 {	
	$results = addEmployee($_POST);
	
	 print_r($results);
	
 	if($_POST['createNew'] === '1')
 	{	
		if($results === TRUE)
		{
			header("location:list.php");
		}
		else
		{
			$row = $_POST;			
		}
 	}
	
	
 }

?>
<!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title><?=$title ?> New Employee</title>
         <? require('../inc/header-info.php'); ?>
    </head>
    <body>
        <div class="container">
            <? include('../inc/nav.php'); ?>
             <form name="newEmployee" method="post" action="create.php">
             	<h4>Create New Employee</h4>
             	<input type="hidden" name="createNew" value='1'> 
            	
					<label class="control-label" for="user_id">User ID:</label>
					<div class="controls">
						<input type="text" id="user_id" name="user_id" placeholder="User ID" <? if($row['user_id']){ echo "value='$row[user_id]'";} ?>>
					</div>
				
    			
					<label class="control-label" for="first_name">First Name:</label>
					<div class="controls">
						<input type="text" id="first_name"  name="first_name" placeholder="First Name" <? if($row['first_name']){ echo "value='$row[first_name]'";} ?>>
					</div>
				
				
					<label class="control-label" for="middle_name">Middle Name:</label>
					<div class="controls">
						<input type="text" id="middle_name" name="middle_name" placeholder="Middle Name" <? if($row['middle_name']){ echo "value='$row[middle_name]'";} ?>>
					</div>
				
					<label class="control-label" for="last_name">Last Name:</label>
					<div class="controls">
						<input type="text" id="last_name" name="last_name" placeholder="Last Name" <? if($row['last_name']){ echo "value='$row[last_name]'";} ?>>
					</div>
    			
    				<label class="control-label">Security Level</label>
    				<div class="controls">
    					<select name='access_index'>
							<option value='15'>Administrator</option>			
							<option value='16'>User</option>
						</select>
    				</div>			
            	<div class="form-actions">
  					<button type="submit" class="btn btn-primary">New Employee</button>
					<button type="button" class="btn">Cancel</button>
				</div>	
            </form> 
		</div>
	</body>
	<script type="application/javascript" src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
	<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
	<script type="text/javascript">
		$(function()
		{
			$('#newEmployee').validate();
		});
		
	</script>
</html>
